package model

import (
	"gorm.io/gorm"
	"time"
)

type BaseModel struct {
	ID        int32     `gorm:"primarykey"`
	CreatedAt time.Time `gorm:"column:add_time"`
	UpdatedAt time.Time `gorm:"column:update_time"`
	DeletedAt gorm.DeletedAt
	IsDeleted bool
}

// 用户表
type User struct {
	BaseModel
	UserName string
	Mobile   string
}

// 订单
type Order struct {
	BaseModel
	OrderSnc    string
	UserId      int64
	PayType     int32
	OrderStatus int32
	AmountPrice float64
	OrderDetail []OrderDetail `gorm:"ForeignKey:OrderSnc"`
}

// 订单子表
type OrderDetail struct {
	BaseModel
	GoodId    int32
	OrderSnc  string
	GoodNum   int32
	GoodPrice float64
	Order     Order `gorm:"ForeignKey:OrderSnc"`
}

// 收获地址
type Address struct {
	BaseModel
	Provincial string
	City       string
	Area       string
	Address    string
	Recipient  string //收件人
	Mobile     string
	IsDefault  int32 //是否默认收获地址
	UserId     int32
}
